package com.example.administrator.easy.view;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.administrator.easy.R;
import com.example.administrator.easy.application.MyApplication;

/**
 * Created by Administrator on 2016/11/16.
 */
//我的   已登录布局
public class WodeYiFragment extends Fragment implements View.OnClickListener{
    private Button btn;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_wode_yi, null);
        setListener(view);
        return view;
    }

    private void setListener(View view) {
        btn = (Button) view.findViewById(R.id.btn_logout);
        btn.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.wode_iv://点击头像，设置资料
                break;
            case R.id.tv_zhui://追星
                //跳到追星页面
                startActivity(new Intent(getActivity(), ZhuixingActivity.class));
                break;
            case R.id.tv_ding://订单
                startActivity(new Intent(getActivity(), DingdanActivity.class));
                break;
            case R.id.tv_gou://购物车
                startActivity(new Intent(getActivity(), GouwucheActivity.class));
                break;
            case R.id.tv_want://我想要的商品
//
                break;
            case R.id.tv_shou://收藏
                break;
            case R.id.tv_ping://我的评论
                break;
            case R.id.tv_tong://通知
                break;
            case R.id.tv_she://设置
                break;
            case R.id.btn_logout://退出登录
                FragmentTransaction t = getChildFragmentManager().beginTransaction();
                t.hide(this).show(new WodeNoFragment());
                t.commit();
                MyApplication a = (MyApplication) getActivity().getApplication();
                a.setLogin(false);
                break;
        }
    }
}
